import Cookie from "js-cookie";

export const setCookie = (key='X-Token',val)=>{
    if(!window.sessionStorage){
        console.log("浏览器不支持sessionStorage");
   }else{
       //主逻辑业务
       sessionStorage.setItem(key, val);
   }
    Cookie.set(key,val)
}

export const getCookie = (key="X-Token")=>{
    if(Cookie.get(key)){
        return  Cookie.get(key);
    }else{
        return sessionStorage.getItem(key);
    }
}

export const removeCookie = (key="X-Token")=>{
    sessionStorage.removeItem(key)
    Cookie.remove(key)
}
